package com.bz.redis.service.impl;

import com.bz.redis.service.ItemCategoryService;
import com.bz.vo.CatVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

@Service
public class ItemCategoryServiceImpl implements ItemCategoryService {

    @Autowired
    private RedisTemplate<String,Object> redisTemplate;

    private final String frontend_catresult_redis_key = "frontend:catresult:redis:key";

    @Override
    public void insertItemCategory(CatVo catVo) {
        redisTemplate.opsForValue().set(frontend_catresult_redis_key,catVo);
    }

    @Override
    public CatVo selectItemCategory() {
        return (CatVo)redisTemplate.opsForValue().get(frontend_catresult_redis_key);
    }
}
